# Contributor: Hoang Nguyen <folliekazetani@protonmail.com>
# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=popeye
pkgver=0.21.3
pkgrel=0
pkgdesc="Kubernetes cluster resource sanitizer"
url="https://popeyecli.io/"
arch="all"
license="Apache-2.0"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/derailed/popeye/archive/refs/tags/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	GOLDFLAGS="
	-X github.com/derailed/popeye/cmd.version=v$pkgver
	-X github.com/derailed/popeye/cmd.commit=AlpineLinux
	-X github.com/derailed/popeye/cmd.date=$(date +%FT%T%Z)
	"
	go build -v -tags netgo -o $pkgname -ldflags "$GOLDFLAGS"
}

check() {
	go test ./...
}

package() {
	install -Dm755 $pkgname -t "$pkgdir"/usr/bin/
}

sha512sums="
d43c7b3022ca5f3560a9709f535bbdb7fc71545dc773ec2334d6a914f91f0c7a1476ec97b44c8e3a7e3c81f97f7c3d803054a2d4c8106816436e800c5419483f  popeye-0.21.3.tar.gz
"
